﻿namespace SugarTank.Mobile.IoC
{
    using Ninject;
    using ViewModels;

    public class ServiceLocator
    {
        private static readonly IKernel Kernel;

        /// <summary>
        /// Initializes static members of the <see cref="ServiceLocator"/> class.
        /// </summary>
        static ServiceLocator()
        {
            if (Kernel == null)
            {
                Kernel = new StandardKernel(new Module());
            }
        }

        /// <summary>
        /// Gets the main view model.
        /// </summary>
        /// <value>The main view model.</value>
        public MainViewModel MainViewModel
        {
            get { return Kernel.Get<MainViewModel>(); }
        }
    }
}